from flask import Flask, jsonify
from books import Book

'''
接口说明：
1.返回的是json数据
2.结构如下：
{
	resCode = 0  # 非0即错误 1
	data:  # 数据位置，一般为数组
	message: '对本次请求的说明'
}
'''

app = Flask(__name__)

app.config['JSON_AS_ASCII'] = False
app.config['JSONIFY_MIMETYPE'] = "application/json;charset=utf-8"


@app.route('/')
def index():
    book = Book()
    data = book.get_books_infos_limit()
    print(data[1])
    return jsonify(data)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8000, debug=True)
